<template>
	<view>
		用户 {{$store.state.name}} -- {{ age }}
		
		<button @click="addClick">修改 年龄</button>
	</view>
</template>

<script>
		
	import { mapState,mapMutations } from 'vuex'
	
	export default {
		data() {
			return {
				
			}
		},
		computed: {
			...mapState(['age'])
		},
		methods: {
			...mapMutations(['add']),
			addClick(){
				// this.$store.commit('add', 2)
				this.add(2)
			}
		}
	}
</script>

<style>

</style>
